package pl.put.dcs.workManagerServer.projectManager.queueManager.cacheManeger.CacheManagerImpl;

import pl.put.dcs.workManagerServer.projectManager.queueManager.cacheManeger.Cache;
import pl.put.dcs.workManagerServer.projectManager.queueManager.cacheManeger.CacheManager;
import pl.put.dcs.workManagerServer.projectManager.queueManager.cacheManeger.exceptions.CacheConnectionErrorException;
import pl.put.dcs.workManagerServer.projectManager.queueManager.cacheManeger.listeners.CacheContentChangeListener;
import pl.put.model.packet.Packet;

// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
// #[regen=yes,id=DCE.2038F893-D65F-ADB7-53A2-1A54A43055C6]
// </editor-fold> 
public abstract class CacheManagerImpl implements CacheManager
{

    public static final String RECIVERS_NODE = "outPackets";

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.416AC2BE-ADF5-3E72-4B45-33567B0F72D9]
    // </editor-fold> 
    private CacheContentChangeListener cacheContentChangeListener;
    private Cache cacheProperties;

    /**
     * Get the value of cacheProperties
     *
     * @return the value of cacheProperties
     */
    public Cache getCacheProperties()
    {
        return cacheProperties;
    }

    /**
     * Set the value of cacheProperties
     *
     * @param cacheProperties new value of cacheProperties
     */
    public void setCacheProperties( Cache cacheProperties )
    {
        this.cacheProperties = cacheProperties;
    }

    public CacheManagerImpl( Cache cacheProp )
    {
        cacheProperties = cacheProp;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.6B3CC3E0-6A55-3EE7-8661-6F80F8692CB1]
    // </editor-fold> 
    public abstract void putPacketInCache( Packet packet );

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.89E85EB0-5FDA-539B-7DDC-D9234783E886]
    // </editor-fold> 
    public boolean isPacketsNumberLimitReached()
    {
        return true;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.8056B61D-4D66-BC79-E5E2-741471D3B4D9]
    // </editor-fold> 
    public abstract Packet popPacketFromCache( String packetId );

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.6386146A-AC9F-CD19-BF6E-B5D556B2318F]
    // </editor-fold> 
    public abstract void connect() throws CacheConnectionErrorException;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.784F62D9-37E9-3E82-69DB-88200AE45A90]
    // </editor-fold> 
    public CacheContentChangeListener getCacheContentListener()
    {
        return cacheContentChangeListener;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.F6CAAF8F-3DB9-FE45-5287-8663FD2CECC2]
    // </editor-fold> 
    public void setCacheContentChangeListener( CacheContentChangeListener val )
    {
        cacheContentChangeListener = val;
    }

    @Override
    public abstract Packet getPacketFromCache( String packetId );
}

